<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<!--<link href="/css/web/themes/about.css" rel="stylesheet">-->
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<style>
    .flex_box {
        display: flex;
        padding: 15px 20px;
        border-bottom: 1px solid #efefef;
        flex-direction: column;
    }
    .flex_box p {
        margin:0;
        padding:0
    }
</style>
<body id="body">
<!--<div th:include="certificateWeb/headFoot :: header"></div>-->
<main id="main">
    <section style="width: 100%">
<!--        <div class="div_1">-->
<!--            <ul>-->
<!--                <li><a href="/certificate/policyInfo">政策信息</a></li>-->
<!--                <li class="this"><a href="/certificate/noticeInfo">通知公告</a></li>-->
<!--                <li><a href="/certificate/tradeInfo">工作动态</a></li>-->
<!--                <li><a href="/certificate/schoolMien">试点院校风采</a></li>-->
<!--            </ul>-->
<!--        </div>-->

        <div style="width: 100%;background:#fff">
            <div id="news"></div>
            <div id="page"></div>
        </div>

        <div style="clear: both"></div>
    </section>
</main>
<!--<div th:include="certificateWeb/headFoot :: footer"></div>-->
<script src="/lib/jquery/jquery.min.js"></script>
<script>
    $(function () {
        $.ajax({
            url: "/jzApi/index/selNewsList",
            type: 'GET',
            data: {
                firstColumn:'证书考试门户',
                columnName: '通知公告',
                current: 1,
                number:14
            },
            success: function (res) {
                console.log(res);
                if(res.data.pages==0){
                    $("#news").html('<div class="noData">暂无数据</div>');
                }else{
                    var list = res.data.records;
                    var news = '';

                    list.forEach(function (item, index) {
                        var a = '';
                        if (item.istop == 1){
                            a = '<span class="top">🔝置顶</span>';
                        }
                        news += '<a href="/certificate/policyDetailMobile?id=' + item.id + '" target="_blank" class="flex_box"><span class="span_2" style="margin-bottom: 10px">' +a+ item.title + '</span>' +
                            '<p class="span_1">' + item.createrDate + '</p></a>';
                    });
                    $("#news").html(news);
                    page(1,res.data.pages);
                }
            }
        });
    });
    function page(num,tolPages) {
        $("#page").paging({
            nowPage:Number(num), // 当前页码
            pageNum:Number(tolPages), // 总页码
            buttonNum:10, //要展示的页码数量
            canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
            showOne: 0,//只有一页时，是否显示。0=不显示,1=显示（默认）
            callback: function (num) { //回调函数
                $.ajax({
                    url: "/jzApi/index/selNewsList",
                    type: 'GET',
                    data: {
                        firstColumn:'证书考试门户',
                        columnName: '通知公告',
                        current: num,
                        number: 14
                    },
                    success:function (res) {
                        var list = res.data.records;
                        var news = '';
                        list.forEach(function (item, index) {
                            var a = '';
                            if (item.istop == 1){
                                a = '<span class="top">🔝置顶</span>';
                            }
                            news += '<a href="/certificate/policyDetailMobile?id=' + item.id + '" target="_blank"class="flex_box"><span class="span_2" style="margin-bottom: 10px">' + item.title + '</span>' +
                                '<p class="span_1">' + item.createrDate + '</p></a>';
                        });
                        $("#news").html(news)
                    }
                });
            }
        });
    }
</script>
<script type="text/javascript" src="/js/xlPaging.js"></script>
</body>
</html>